package club.mzywucai.blog.air_portal;

import club.mzywucai.blog.air_portal.pojo.domain.FileCodeContainer;
import club.mzywucai.blog.air_portal.pojo.domain.MakeDir;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableScheduling
@SpringBootApplication
@MapperScan("club.mzywucai.blog.air_portal.mapper")
@ServletComponentScan
public class AirPortalApplication implements ApplicationRunner {

    @Autowired
    FileCodeContainer fileCodeContainer;

    @Autowired
    MakeDir makeDir;

    public static void main(String[] args) {
        SpringApplication.run(AirPortalApplication.class, args);


    }

    /**
     * @Description 初始化的时候，调度一下查询
     * @author mzywucai
     * @time 2019-06-03
     * @see 
     * @return   void
     * @params  [args]
     */
    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.err.println("Successful service startup!");

        fileCodeContainer.getNewFileCodeList();

        makeDir.mkdir();

        System.err.println("do some init operation.");
    }
}
